---
title: Custom Popup with Dynamic Map Layer
description: Customizing a popup on a Dynamic Map Layer. Click to render a popup. More information about Map Services can be found in the <a href="../api-reference/layers/dynamic-map-layer.html">L.esri.DynamicMapLayer</a> documentation.
layout: example.hbs
---

<div id="map"></div>

<script>
  var map = L.map('map').setView([38.5, -96.8], 4);
  L.esri.basemapLayer('Gray').addTo(map);

  var wildfireRisk = L.esri.dynamicMapLayer({
    url: 'https://maps7.arcgisonline.com/arcgis/rest/services/USDA_USFS_2014_Wildfire_Hazard_Potential/MapServer'
  }).addTo(map);

  wildfireRisk.bindPopup(function (error, featureCollection) {
    if(error || featureCollection.features.length === 0) {
      return false;
    } else {
      return 'Risk Level: ' + featureCollection.features[0].properties.CLASS_DESC;
    }
  });
</script>
